<admintpl file="header" />
</head>
<body>
	<div class="wrap js-check-wrap">
		<ul class="nav nav-tabs">
			<li class="active"><a href="{:U('Exams/card')}">准考证管理</a></li>
			<li><a href="{:U('Exams/card_add')}">生成准考证</a></li>
		</ul>
		<form class="well form-search" method="post" action="{:U('Exams/card')}">
			考试分类： 
			<select name="exam_term_id" id="exam_term" style="width: 120px;">
				<option value='0'>全部</option>{$exam_taxonomys}
			</select> &nbsp;&nbsp;
			工种： 
			<select name="ques_term_id" id="ques_term" style="width: 120px;">
				<option value='0'>全部</option>{$ques_taxonomys}
			</select> &nbsp;&nbsp;
			考试： 
			<select name="exam_id" id="exam_id">
			<option value="0">请选择考试</option>
			<volist name="exam_list" id="exam">
			<option value="{$exam.id}">[ID:{$exam.id}]{$exam.exam_name}</option>
			</volist>
			</select><a id="lb_view" href="javascript:;" style="display:none">看题</a> &nbsp;&nbsp;
			身份证号：
			<input type="text" name="keyword" style="width: 200px;" value="{$keyword}" placeholder="请输入题干">
			<input type="submit" class="btn btn-primary" value="搜索" />
			<a class="btn btn-danger" href="{:U('Exams/index')}">清空</a>
		</form>
		<form class="js-ajax-form" action="{:U('Exams/listorders')}" method="post">
			<div class="table-actions">
				<button class="btn btn-primary btn-small" type="submit" formaction="{:U('Exams/card_list_export')}">导出结果到EXCEL</button>
				<button class="btn btn-danger btn-small js-ajax-submit" type="submit" data-action="{:U('Exams/card_delete')}" data-subcheck="true" data-msg="您确定删除吗？">{:L('DELETE')}</button>
			</div>
			<table class="table table-hover table-bordered table-list" id="menus-table">
				<thead>
					<tr>
						<th width="15"><label><input type="checkbox" class="js-check-all" data-direction="x" data-checklist="js-check-x"></label></th>
						<th>准考证号</th>
						<th>身份证号</th>
						<th width="80">姓名</th>
						<th>考试名称</th>
						<th width="150">考试分类/工种</th>
						<th width="120">开考时间</th>
						<th>生成时间</th>
						<th width="40">{:L('STATUS')}</th>
						<th width="80">{:L('ACTIONS')}</th>
					</tr>
				</thead>
				<tbody>
				<foreach name="card_list" item="vo">
				<tr>
					<td><input type="checkbox" class="js-check" data-yid="js-check-y" data-xid="js-check-x" name="ids[]" value="{$vo.id}" title="ID:{$vo.id}"></td>
					<td>{$vo.code|strtoupper}</td>
					<td>{$vo['id_card']}</td>
					<td>{$vo['name']}</td>
					<td>{$vo['exam_name']}</td>
					<td>{$exam_terms[$vo['exam_term']]}/{$ques_terms[$vo['ques_term']]}</td>
					<td>{:date('Y-m-d H:i',strtotime($vo['exam_start_time']))}</td>
					<td>{:date('Y-m-d H:i',strtotime($vo['create_time']))}</td>
					<td>
						<eq name="vo.card_status" value="0">
							<a data-toggle="tooltip" title="已启用"><i class="fa fa-check"></i></a>
							<else/>
							<a data-toggle="tooltip" title="已停用"><i class="fa fa-close"></i></a>
						</eq>
					</td>
					<td>						
						<a href="{:U('Exams/card_delete',array('id'=>$vo['id']))}" class="js-ajax-delete">{:L('DELETE')}</a>
					</td>
				</tr>
				</foreach>
				</tbody>
				<tfoot>
					<tr><th width="15"><label><input type="checkbox" class="js-check-all" data-direction="x" data-checklist="js-check-x"></label></th>
						<th>准考证号</th>
						<th>身份证号</th>
						<th width="80">姓名</th>
						<th>考试名称</th>
						<th width="150">考试分类/工种</th>
						<th width="120">开考时间</th>
						<th>生成时间</th>
						<th width="40">{:L('STATUS')}</th>
						<th width="80">{:L('ACTIONS')}</th>
					</tr>
				</tfoot>
			</table>
			<div class="pagination">{$page}</div>
		</form>
	</div>
	<script src="__PUBLIC__/js/common.js"></script>
	<script type="text/javascript" src="__PUBLIC__/js/layer/layer.js"></script>
	<script>
	function loadExams(ques_term,exam_term){
		$.ajax({
			url:"{:U('exams/get_exams_json')}",
			data:{"ques_term":ques_term,"exam_term":exam_term},
			type:'POST',
			async:true,
			timeout:5000,    //超时时间
		    dataType:'json',
		    success:function(data,textStatus,jqXHR){
		    	if(data.status==1){
					var lst_exam=data.content;
					var arr_option=[];
					$('#exam_id').empty();
		    		$('#exam_id').append('<option value="0">↓请选择考试['+lst_exam.length+']↓</option>');
					for(var exam in lst_exam){
						$('#exam_id').append('<option value="'+lst_exam[exam].id+'">[ID:'+lst_exam[exam].id+']'+lst_exam[exam].exam_name+'</option>');
					}
		    	}
		    	else{
		    		$('#exam_id').empty();
		    		$('#exam_id').append('<option value="0">↓请选择考试[0]↓</option>');
		    		
		    	}

		    	$('#exam_id').val('{$exam_id}');
			}
		});
	}
	$('#ques_term').change(function(){
		loadExams($(this).val(),$('#exam_term').val());
	});
	$('#exam_term').change(function(){
		loadExams($('#ques_term').val(),$(this).val());
	});
	$('#ques_term').change();

	function showSignin(url){		
		layer.open({
		      type: 2,
		      title: '报名及考试情况查看',
		      shadeClose: true,
		      shade: false,
		      maxmin: true, //开启最大化最小化按钮
		      area: ['893px', '870px'],
		      content: url,
		      success:function(layero, index){
		    	  //layer.full(index);
		      }
		});
	}
	function showFinish(url){
		showSignin(url);
	}
	
	$(document).ready(function() {
		Wind.css('treeTable');
		Wind.use('treeTable', function() {
			$("#menus-table").treeTable({
				indent : 20
			});
		});
	});

	setInterval(function() {
		var refersh_time = getCookie('refersh_time_admin_menu_index');
		if (refersh_time == 1) {
			reloadPage(window);
		}
	}, 1000);
	setCookie('refersh_time_admin_menu_index', 0);
	</script>
</body>
</html>